package com.zq.controller;

import com.zq.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 用户Controller
 */
public class UserController {
    public static void main(String[] args) {
        //读取配置文件，创建IOC容器
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
        //从容器中获取实例
        UserService userService = (UserService) applicationContext.getBean("userService");
        userService.saveUser();
        applicationContext.close();
    }
}
